;; 我的LISP编程设置
(defmacro add-hook-lisp (x)
  "将参数添加到所有关于LISP的major mode的hook中"
  (add-hook 'lisp-mode-hook x)
  (add-hook 'lisp-interaction-mode-hook x)
  (add-hook 'emacs-lisp-mode-hook x)
  (add-hook 'scheme-mode-hook x)
  (add-hook 'geiser-mode-hook x) 
  (add-hook 'geiser-repl-mode-hook x)
)
(add-hook-lisp (lambda () (paredit-mode 1)))			
(global-set-key (kbd "<f6>") 'match-paren) ;; 使用f6匹配括号
;; 关于geiser的配置
(setq scheme-program-name "racket -I typed/racket") ;; 使用（Typed）Racket作为解释器
;; 一些默认未绑定的算子
(defvar *binding-constructs*
  '(let-values
    let*-values
    hash-for-each
    letv
    let\:
    lambda\:
    letv*
    match
    pmatch
    for
    for/list
    fun
    record))
;; Geiser的AC配置 
(add-hook 'geiser-mode-hook 'ac-geiser-setup)
(add-hook 'geiser-repl-mode-hook 'ac-geiser-setup)
(add-to-list 'ac-modes 'geiser-mode)
(add-to-list 'ac-modes 'geiser-repl-mode)
;; Emacs Lisp的配置
(defun el-hook-func ()
  "Emacs Lisp Mode的hook函数"
  (define-key emacs-lisp-mode-map (kbd "<f5>") 'eval-last-sexp) ;; 运行前面的表达式
  (define-key emacs-lisp-mode-map (kbd "<f1>") 'eval-defun) ;; 装入函数
)
(add-hook 'emacs-lisp-mode-hook 'el-hook-func)
;; （Common）Lisp的配置
(defun lisp-hook-func ()
  "Lisp Mode的hook函数"
  (paredit-mode 1)
  (define-key lisp-mode-map (kbd "<f5>") 'slime-eval-last-expression)
  (define-key lisp-mode-map (kbd "<f1>") 'slime-eval-defun)
)
(el-get2load-path "slime") ;; 将SLIME放进load-path
(setq inferior-lisp-program "/usr/bin/sbcl --dynamic-space-size 4096") ;; 使用解释器，视不同情况更改
(require 'slime) ;; 加载SLIME
(slime-setup) ;; 安装SLIME
(add-hook 'slime-mode-hook 'lisp-hook-func)
;; 还是Auto-complete……
(add-hook 'slime-mode-hook 'set-up-slime-ac)
(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
(add-to-list 'ac-modes 'slime-repl-mode)


(provide 'lisp-setting)
